from sqlalchemy import Column, String, Integer, VARCHAR, ForeignKey, Float
from sqlalchemy.orm import relationship,backref
from models import Base


class UserModel(Base):
    __tablename__ = 'user'
    id = Column(Integer, primary_key=True)
    nickname = Column(VARCHAR(255))
    username = Column(VARCHAR(255))
    password = Column(VARCHAR(255))
    good = relationship("Good", lazy="select")


class Good(Base):
    __tablename__ = 'good'
    id = Column(Integer, primary_key=True)
    name = Column(VARCHAR(255))
    price = Column(Integer)
    user_id = Column(Integer, ForeignKey('user.id'))
    course = relationship("Course", lazy="select")


class Course(Base):
    __tablename__ = 'course'
    id = Column(Integer, primary_key=True)
    name = Column(VARCHAR(255))
    good_id = Column(Integer, ForeignKey('good.id'))


